package com.engine4cloud.tdf.supervision.convert;

import com.engine4cloud.tdf.common.core.util.CodeUtils;
import com.engine4cloud.tdf.supervision.dto.create.KhjcAssessmentCreateDTO;
import com.engine4cloud.tdf.supervision.dto.result.KhjcAssessmentResultDTO;
import com.engine4cloud.tdf.supervision.dto.update.KhjcAssessmentUpdateDTO;
import com.engine4cloud.tdf.supervision.entity.JzdxAssessmentEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper
public interface KhjcAssessmentConvert {
    KhjcAssessmentConvert INSTANCE = Mappers.getMapper(KhjcAssessmentConvert.class);

    KhjcAssessmentResultDTO convert(JzdxAssessmentEntity s);

    JzdxAssessmentEntity createTo(KhjcAssessmentCreateDTO s);

    JzdxAssessmentEntity update(KhjcAssessmentUpdateDTO s);

    default JzdxAssessmentEntity create(KhjcAssessmentCreateDTO s, Long tenantId) {
        JzdxAssessmentEntity entity = createTo(s);
        entity.setTenantId(tenantId);
        entity.setLcbh(CodeUtils.entrustCode());
        return entity;
    }
}
